#include <stdio.h>
int main(int argc, char *argv[])
{
   int count=0;
   float total=0;
   float tmp=0;
   int nw=atoi(argv[2]);//come parametro si passa il num worker
   FILE *fin=fopen(argv[1],"r");//e primo il file
   //fscanf(fin,"%d\n",&nw);
   while(!feof(fin))
   {
      count++;
      fscanf(fin,"%f\n",&tmp);
      total+=tmp;
   }
   total=total/((float)count);
   printf("NWorker=%d, Numero test: %d, valore medio:%f\n",nw,count,total);
   FILE *out=fopen("result","a");
   fprintf(out,"%d %f\n",nw,total);
   fclose(out);
   fclose(fin);

}
